admin: Prepare /var/log/dracut.log when creating initramfs
authorColin Walters <walters@verbum.org>
Mon, 1 Oct 2012 14:25:36 +0000 (10:25 -0400)
committerColin Walters <walters@verbum.org>
Mon, 1 Oct 2012 14:25:36 +0000 (10:25 -0400)
Otherwise dracut complains.

src/ostree/ot-admin-builtin-update-kernel.c

index df2d575faa6508c1155ca8719eb7ee8e7b68ed1f..57f232836bf6971ed65823c5cc110809591f59c6 100644 (file)
@@ -88,6 +88,8 @@ update_initramfs (OtAdminUpdateKernel  *self,
       ot_lobj GFile *ostree_moduledir = NULL;
       ot_lobj GFile *initramfs_tmp_file = NULL;
       ot_lobj GFileInfo *initramfs_tmp_info = NULL;
+      ot_lobj GFile *dracut_log_path = NULL;
+      ot_lobj GOutputStream *tmp_log_out = NULL;
           
       if (!ostree_create_temp_dir (NULL, "ostree-initramfs", NULL, &tmpdir,
                                    cancellable, error))
@@ -96,6 +98,15 @@ update_initramfs (OtAdminUpdateKernel  *self,
       ostree_vardir = g_file_get_child (self->ostree_dir, "var");
       ostree_moduledir = g_file_get_child (self->ostree_dir, "modules");
 
+      dracut_log_path = ot_gfile_get_child_build_path (ostree_vardir, "log", "dracut.log", NULL);
+      tmp_log_out = (GOutputStream*)g_file_replace (dracut_log_path, NULL, FALSE,
+                                                    G_FILE_CREATE_REPLACE_DESTINATION,
+                                                    cancellable, error);
+      if (!tmp_log_out)
+        goto out;
+      if (!g_output_stream_close (tmp_log_out, cancellable, error))
+        goto out;
+
       mkinitramfs_args = g_ptr_array_new ();
       /* Note: the hardcoded /tmp path below is not actually a
        * security flaw, because we've bind-mounted dracut's view